package com.ds.infrastructure.hyperspace.console.model.request.form;

import com.ds.infrastructure.hyperspace.console.entity.page.TbPageWhere;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Max;

/**
 * @author: yaozhendong
 * @create: 2019-09-17 16:29
 **/
@Data
@NoArgsConstructor
public class PageForm {

    @ApiModelProperty(example = "10")
    @Max(200)
    private Integer pageSize = 10;

    private Integer pageIndex = 0;

    public static TbPageWhere toPageWhere(PageForm form) {
        return TbPageWhere.newPage(form.pageIndex, form.pageSize);
    }
}
